package com.hnas.ecard.mapper;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.hnas.core.mapper.Mapper;
import com.hnas.ecard.orm.MerchantDetail;
import com.hnas.ecard.service.dto.DTOMerchantDetail;

public class MerchantDetailMapper extends Mapper<DTOMerchantDetail,MerchantDetail>{

    private static MerchantDetailMapper mapper;

	
	private MerchantDetailMapper(){
		super(DTOMerchantDetail.class,MerchantDetail.class);
	}
	
	public static MerchantDetailMapper getInstance(){
		if(mapper == null){
			mapper = new MerchantDetailMapper();
		}
		return mapper;
	}
	
	public DTOMerchantDetail mapToValue(MerchantDetail vo){
		DTOMerchantDetail dto = new DTOMerchantDetail();
		BeanUtils.copyProperties(vo, dto);
		return dto;
	}
	
	public List<DTOMerchantDetail> mapToValue(List<MerchantDetail> list){
		List<DTOMerchantDetail> dtoList = new ArrayList<DTOMerchantDetail>();
		for(MerchantDetail vo : list){
			DTOMerchantDetail dto = mapToValue(vo);
			dtoList.add(dto);
		}
		return dtoList;
	}
}
